package users;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.Scanner;
import dpssinterface.dpssInterface;
import users.AdministratorClient;

public class AdministratorClient extends Thread{

	
    public static void main(String args[]) throws RemoteException, NotBoundException{
            Registry  registry= LocateRegistry.getRegistry(1099);         
			dpssInterface NorthAmerica = (dpssInterface) registry.lookup("North");
			dpssInterface Europe = (dpssInterface) registry.lookup("Europe");
			dpssInterface Asia = (dpssInterface) registry.lookup("Asia");
                        
                   @SuppressWarnings("resource")
				Scanner scanner = new Scanner(System.in);
                       System.out.println("Enter username");
                        String User = scanner.next();
                        System.out.println("Enter Password");
                        String Pass = scanner.next() ;
                        
                        if(User.equals("Admin") && Pass.equals("Admin"))
                        {
                                System.out.println("Enter IP address");
                            String IP = scanner.next();
                            if(IP.startsWith("132")){
                                NorthAmerica.getPlayerStatus(User, Pass, IP);
			          	 }else if(IP.startsWith("93")){
                            Europe.getPlayerStatus(User, Pass, IP);
                   }else if(IP.startsWith("182")){
                             Asia.getPlayerStatus(User, Pass, IP);
                   }else {System.out.println("Wrong credentials!");
                        } 
                       }
            }
}
